/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sunsite.dao;

import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import sunsite.po.NewsType;

/**
 *
 * @author mg
 */
public class NewsTypeDaoImpl extends HibernateDaoSupport implements NewsTypeDao{

    public List<NewsType> getNewsType() throws DataAccessException {
        List<NewsType> list = getHibernateTemplate().executeFind(new HibernateCallback() {

            public Object doInHibernate(Session arg0) throws HibernateException, SQLException {
                return arg0.createQuery("from NewsType as n ").list();
            }
        });
        return list;
    }

}
